<h2 class="dialog_title"><span>Jumlah Pelanggaran</span></h2>
<div class="dialog_content" style="padding: 10px 20px; width:700px">
<table width="100%" border="0" cellpadding="5" cellspacing="0">
	<tr>
    	<?php $detachiev = mysql_fetch_assoc(deprepel_load($detachievID));?>
		<td width="80">Kategori: </td>
        <td><strong><?php echo $detachiev['DETACHIEV_NAMA']?></strong></td>
	</tr>
	<tr>
    	<td>Periode : </td>
		<td><strong><?php echo date('m-Y', $startPeriode) ?> - <?php echo date('m-Y', $endPeriode) ?></strong></td>
	</tr>
</table>
<table style="border:1px solid #457A3F;" width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr class="header">
	<th align="left"><span class="colorWhite">Kode Karyawan</span></th>
    <th align="left"><span class="colorWhite">Nama Karyawan Pelaku</span></th>
    <th align="left"><span class="colorWhite">Tgl Lapor</span></th>
    <th align="left"><span class="colorWhite">Jenis</span></th>
    <th align="left"><span class="colorWhite">Bidang</span></th>
    <th align="left"><span class="colorWhite">Tingkat</span></th>
  </tr>
  <tbody id="searchKary-table" style="overflow:scroll; height:200px" >
<?php $result = mysql_query(
					"SELECT a.KODE_KARYAWAN, e.NAMA_KARYAWAN, h.NAMA_DEPARTMENT, a.PERB_TGL,
							c.ACHIEV_JENIS, c.ACHIEV_BIDANG, d.DETACHIEV_TINGKAT
					FROM perbuatan AS a, detil_perbuatan AS b, prestasipelanggaran AS c, 
						detil_prestasi_pelanggaran AS d, data_karyawan as e,
						relasi_div_jab_din as f, dep_divisi_jabatan as g, data_department as h
					WHERE a.PERB_NO = b.PERB_NO
						AND b.DETACHIEV_ID = d.DETACHIEV_ID
						AND d.ACHIEV_ID = c.ACHIEV_ID
						AND a.KODE_KARYAWAN = e.KODE_KARYAWAN
						AND e.KODE_KARYAWAN  = f.KODE_KARYAWAN 
						AND f.ID_DEP_DIV_JAB = g.ID_DEP_DIV_JAB 
						AND	g.ID_DEPARTMENT  = h.ID_DEPARTMENT
						AND DATE_FORMAT(a.PERB_TGL, '%Y-%m') 
							BETWEEN DATE_FORMAT('". date('Y-m-d', $startPeriode) ."', '%Y-%m' ) AND 
									DATE_FORMAT('". date('Y-m-d', $endPeriode) ."', '%Y-%m') 
						AND b.DETACHIEV_ID='$detachievID'" ); ?>
<?php while ($row = mysql_fetch_assoc($result)):?>
	<?php if ($lastName=="" || $lastName != $row['NAMA_DEPARTMENT']) : ?>
    <?php $nameCount++; ?>
    <?php $lastName=$row['NAMA_DEPARTMENT'] ?>
    <tr bgcolor="#CCCCCC">
        <td colspan="7"><?php echo $row['NAMA_DEPARTMENT'] ?></td>
    </tr>
    <?php endif;?>
    
    <tr <?php echo tag_zebra($z++)?>>
        <td><?php echo $row['KODE_KARYAWAN']?></td>
        <td><?php echo $row['NAMA_KARYAWAN']?></td>
        <td><?php echo $row['PERB_TGL']?></td>
        <td><?php echo $row['ACHIEV_JENIS']?></td>
        <td><?php echo $row['ACHIEV_BIDANG']?></td>
        <td><?php echo $row['DETACHIEV_TINGKAT']?></td>
    </tr>
    <?php $count++; ?>
<?php endwhile;?>
  </tbody>
  <tr class="header">
    <th align="right" colspan="5"><span class="colorWhite">Jumlah Pelanggaran : </span></th>
    <th align="right"><span class="colorWhite"><?php echo $count?></span></th>
  </tr>
</table>
</div>
<div class="dialog_buttons"><input type="button" value="Close" name="close" onclick="FBModal_hide()" /></div>